package com.hmall.common.myClient;

import com.hmall.common.pojo.Item;
import com.hmall.common.pojo.PageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "itemservice")
public interface ItemClient {

    @GetMapping("/item/list")
    PageDTO<Item> page(@RequestParam("page") Integer page, @RequestParam("size") Integer size);

    /**
     * 通过id查商品
     *
     * @param id
     * @return
     */
    @GetMapping("/item/{id}")
     Item getById(@PathVariable(value = "id") Long id);


    @PutMapping("/item/stock/{itemId}/{num}")
     void reduceInventory(@PathVariable(value = "itemId")Long id,@PathVariable(value = "num")Integer num);

}